<%@ tag language="java" pageEncoding="UTF-8" body-content="empty" trimDirectiveWhitespaces="true"%>
<%@ attribute name="id" type="java.lang.String" required='true' description="树的id"%>
<%@ attribute name="ajax" type="java.lang.String" required='true' description="请求node节点的ajax的id" %>
<%@ attribute name="onCurrentNodeSelected" type="java.lang.String" description="绑定最近当前节点选中事件，onNodeSelected(node)" %>
<%@ attribute name="onMutiNodesSelected" type="java.lang.String" description="绑定多个节点选中事件，onMutiNodeSelected(nodes)" %>
<%@ attribute name="onChecked" type="java.lang.String" description="捕获 checkbox / radio 被勾选 或 取消勾选的事件回调函数,onChecked(event, treeId, treeNode)" %>
<%@ attribute name="defaultSelectIndex" type="java.lang.Integer" description="设置默认选中第几项，default=0" %>
<%@ attribute name="showRemoveBtn" type="java.lang.Boolean" description="是否显示删除按钮，default=false" %>
<%@ attribute name="canEdit" type="java.lang.Boolean" description="是否可以编辑节点名称，default= false" %>
<%@ attribute name="checkable" type="java.lang.Boolean" description="是否显示复选框，default= false" %>
<%@ attribute name="selectedMulti" type="java.lang.Boolean" description="是否支持多选，default= false" %>
<%@ attribute name="showLine" type="java.lang.Boolean" description="是否显示对齐线条，default= false" %>
<%@ attribute name="dblClickExpand" type="java.lang.Boolean" description="是否支持双击展开，default= false" %>
<%@ attribute name="expandAll" type="java.lang.Boolean" description="是否全部展开，default= false" %>
<%@ attribute name="convertToTemplate" type="java.lang.String" description="将Ztree的单个node节点转为你所需要的node节点的函数，该函数需要返回新的节点，convertToTemplate(node,index)" %>
<%@ attribute name="nodeNameKey" required="true" type="java.lang.String" description="配置映射关系：设置节点名称对应在json中的哪个key，默认为text" %>
<%@ attribute name="nodeUrlKey" required="false" type="java.lang.String" description="配置映射关系：设置节点的url对应在json中的哪个key，默认为url" %>
<%@ attribute name="nodeCheckedKey" required="false" type="java.lang.String" description="配置映射关系：设置节点选中对应在json中的哪个key，默认为checked" %>
<%@ attribute name="nodeChildrenKey" required="true" type="java.lang.String" description="配置映射关系：设置节点的子节点对应在json中的哪个key，默认为children" %>
<%@ attribute name="nodeTitleKey" required="true" type="java.lang.String" description="配置映射关系：设置节点title对应在json中的哪个key，默认为title" %>
<%@ attribute name="nodeIdKey" required="true" type="java.lang.String" description="配置映射关系：设置节点id对应在json中的哪个key，默认为id" %>
<%@ attribute name="parentIdKey" required="true" type="java.lang.String" description="配置映射关系：设置节点pid对应在json中的哪个key，默认为pid" %>
<%@ attribute name="rootPidValue" type="java.lang.String" description="当设置dataStructure=array时，可设置此属性，此属性指返回的数据的根节点的值，默认为null，" %>
<%@ attribute name="maxLayer" type="java.lang.Integer" description="设置允许的最大层级，默认无限制" %>
<%@ attribute name="className" type="java.lang.String" description="设置css样式" %>
<%@ attribute name="idStrategy" type="java.lang.String" description="新增节点时的id生成策略，可选值：uuid/timestamp/none，默认uuid" %>
<%@ attribute name="style" type="java.lang.String" description="风格，默认为none，可选值:outlook" %>
<%@ attribute name="selectRootNode" type="java.lang.Boolean" description="是否选中根节点，默认false" %>
    
<%@ attribute name="dataStructure" type="java.lang.String" description="返回数据的数据结构，可选值：tree/array，默认为array" %>
<%@ attribute name="silent" type="java.lang.Boolean" description="刷新时，是否静默刷新，默认为true" %>
<%@ attribute name="onlyShowFolder" type="java.lang.Boolean" description="所有节点显示为文件夹样式，包括子节点，默认false" %>
<%@ attribute name="showIcon" type="java.lang.Boolean" description="是否显示文件夹图标，默认true" %>
<%@ attribute name="drag" type="java.lang.String" description="是否启用允许拖拽功能，设置拖拽是copy还是移动，可选值：none,move,copy，默认：none" %>
<%@ attribute name="onDrag" type="java.lang.String" description="拖动时的回调函数，onDrag(event, treeId, treeNodes)" %>
<%@ attribute name="rename" type="java.lang.String" description="是否可以编辑节点名称，默认false" %>
<%@ attribute name="onDrop" type="java.lang.String" description="拖动结束时的回调函数，onDrop(event, treeId, treeNodes, targetNode, moveType)" %>
    
<%@ attribute name="onAsyncError" type="java.lang.String" description="用于捕获异步加载出现异常错误的事件回调函数，函数参数onAsyncError(event,treeId,treeNode,XMLHttpRequest,textStatus,errorThrown)" %>
<%@ attribute name="onAsyncSuccess" type="java.lang.String" description="用于捕获异步加载正常结束的事件回调函数，函数参数 onAsyncSuccess(event, treeId, treeNode, msg)" %>
<%@ attribute name="onFinishLoad" type="java.lang.String" description="整个加载完毕的回调函数" %>

<div class='m-loader-wrapper ${className }'>
    <ul class="ztree" id="${id}"></ul>
</div>

<script type="text/javascript">
(function(){
	window.TagSupport.tree({
	    'id':"${id}",                                         'ajax':"${ajax}",      
	    'onCurrentNodeSelected':"${onCurrentNodeSelected}",   'onMutiNodesSelected':"${onMutiNodesSelected}", 
	    'defaultSelectIndex':"${defaultSelectIndex}",         'onChecked':"${onChecked}",
	    'showRemoveBtn':"${showRemoveBtn}",                   'canEdit':"${canEdit}",
	    'checkable':"${checkable}",                           'selectedMulti':"${selectedMulti}",
	    'showLine':"${showLine}",                             'dblClickExpand':"${dblClickExpand}",
	    'convertToTemplate':"${convertToTemplate}",           'nodeNameKey':"${nodeNameKey}",
	    'nodeUrlKey':"${nodeUrlKey}",                         'nodeCheckedKey':"${nodeCheckedKey}",
	    'nodeChildrenKey':"${nodeChildrenKey}",               'nodeTitleKey':"${nodeTitleKey}",
	    'nodeIdKey':"${nodeIdKey}",                           'parentIdKey':"${parentIdKey}",
	    'rootPidValue':"${rootPidValue}",                     'maxLayer':"${maxLayer}",
	    'className':"${className}",                           'dataStructure':"${dataStructure}",
	    'silent':"${silent}",                                 'onAsyncError':"${onAsyncError}",
	    'onAsyncSuccess':"${onAsyncSuccess}",                 'expandAll':'${expandAll}',
	    'idStrategy':"${idStrategy}",                         'onlyShowFolder':"${onlyShowFolder}",
	    'showIcon':"${showIcon}",                             'drag':"${drag}",
	    'onDrag':"${onDrag}",                                 'rename':'${rename}',                                 
	    'onDrop':'${onDrop}',                                 'style':"${style}",
	    'selectRootNode':'${selectRootNode}',                 'onFinishLoad':"${onFinishLoad}"
	});
})();
</script>